package com.base.bean;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import com.base.domain.Socio;

public class SocioDataModel extends ListDataModel<Socio> implements SelectableDataModel<Socio> {    
	  
    public SocioDataModel() {  
    }  
  
    public SocioDataModel(List<Socio> data) {  
        super(data);  
    }  
      
    @SuppressWarnings("unchecked")
	@Override  
    public Socio getRowData(String rowKey) {  
       List<Socio> socios = (List<Socio>) getWrappedData();  
        
        Socio temp = new Socio();
        temp.setId(new Integer(rowKey));
        
        int index = socios.indexOf(temp);
        return socios.get(index);
    }  
  
    @Override  
    public Object getRowKey(Socio socio) {  
        return socio.getId();  
    }  
    
   
}  
